//
//  WmcSettingTipContentItemCell.swift
//  YPWatermarkCamera
//
//  Created by Json on 2023/7/24.
//

import UIKit

class WmcSettingTipContentItemCell: WmcSettingContentItemCell {

    
    override func makeUI() {
        super.makeUI()
        if let index = stackView.arrangedSubviews.firstIndex(of: titleLabel) {
            stackView.insertArrangedSubview(wmc_imageView, at: index + 1)
            wmc_imageView.snp.makeConstraints { make in
                make.size.equalTo(0.0)
            }
        }
    }
    
    override func didSetItem() {
        super.didSetItem()
        let tipItem = (item as? WmcSettingTipContentItem) ?? .init()
        wmc_imageView.image = tipItem.image
        wmc_imageView.snp.updateConstraints { make in
            make.size.equalTo(tipItem.imageSize)
        }
        wmc_imageView.isHidden = (tipItem.image.size == .zero)
    }

}
